﻿
Partial Class WebForm_Main_ShowBanner
    Inherits System.Web.UI.UserControl

    Protected Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            Dim linkBanner As HyperLink = TryCast(e.Item.FindControl("linkBanner"), HyperLink)
            Dim theFileName As String = linkBanner.ImageUrl
            Dim newUrl As String
            If System.IO.File.Exists(Server.MapPath(theFileName)) Then
                linkBanner.Visible = True
                newUrl = linkBanner.NavigateUrl.Replace("http://", "")
                If newUrl <> "" Then newUrl = "http://" & newUrl
                linkBanner.Attributes("onclick") = "window.open('" & newUrl & "');return false;"
            Else
                linkBanner.Visible = False
            End If
        End If
    End Sub
End Class
